﻿using Autofac;
using CacheAOP_Castle.AOPCache;
using CacheAOP_Castle.BLL;
using CacheAOP_Castle.Service;
using Microsoft.AspNetCore.Mvc;

namespace CacheAOP.Controllers
{
    [Route("api/[controller]")]
    public class ValuesController : Controller
    {
        private IDateTimeService _dateTimeService;

        public ValuesController(IDateTimeService dateTimeService)
        {
            _dateTimeService = dateTimeService;
        }
        [HttpGet]
        public string Get()
        {
            return _dateTimeService.GetCurrentTime();
        }
    }

    [Route("api/[controller]")]
    public class BllController : Controller
    {
        private ILifetimeScope _scope;
        private DateTimeBLL _dateTimeBLL;

        public BllController(ILifetimeScope scope)
        {
            this._scope = scope;
            _dateTimeBLL = _scope.Resolve<DateTimeBLL>();
        }
        [HttpGet]
        public string Get()
        {
            return _dateTimeBLL.GetCurrentTime();
        }
    }
}
